﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Supersense.db;

public partial class admin_solution_add : System.Web.UI.Page
{
    private Database db = new Database();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            string subject = Request.Form["subject"].Trim();
            string eventdate = Request.Form["eventdate"];
            //if (file.HasFile)
            //{
            //    string img = DateTime.Now.ToString("yyyyMMddHHis") + file.FileName;
            //    file.PostedFile.SaveAs(Server.MapPath("~/uploads/") + img);
            //}
            string content = Request.Form["content"].Trim();

            //response.write(foreign_url == "");

            string settop = Request.Form["settop"].Trim();
            string sql = "INSERT INTO sup_spacenews (subject,eventdate,sup_spacenews.type,sup_spacenews.text,settop,postip,author) values ";
            sql += "('" + subject + "','" + eventdate + "','solution','" + content + "','" + settop + "','" + Request.ServerVariables.Get("Remote_Addr").ToString() + "','system')";
            if (this.db.executesql(sql))
            {
                Response.Write("<script type='text/javascript'>alert('您执行的操作成功了!')</script>");
                Response.Write("<meta http-equiv='refresh' content='0;url=list.aspx'/>");
            }
            else
            {
                Response.Write("<script type='text/javascript'>alert('您执行的操作失败了!');history.go(-1);</script>");
            }
        }
    }
}
